# $Id$
# Maintainer: Ray Rashif <schiv@archlinux.org>
# Contributor: dorphell <dorphell@archlinux.org>

pkgname=audiofile
pkgver=0.3.6
pkgrel=4
pkgdesc="Silicon Graphics Audio File Library"
arch=('i686' 'x86_64')
url="https://audiofile.68k.org/"
license=('LGPL')
depends=('gcc-libs' 'alsa-lib' 'flac')
source=("https://audiofile.68k.org/$pkgname-$pkgver.tar.gz"
        01_gcc6.patch
        03_CVE-2015-7747.patch
        04_clamp-index-values-to-fix-index-overflow-in-IMA.cpp.patch
        05_Always-check-the-number-of-coefficients.patch
        06_Check-for-multiplication-overflow-in-MSADPCM-decodeSam.patch
        07_Check-for-multiplication-overflow-in-sfconvert.patch
        08_Fix-signature-of-multiplyCheckOverflow.-It-returns-a-b.patch
        09_Actually-fail-when-error-occurs-in-parseFormat.patch
        10_Check-for-division-by-zero-in-BlockCodec-runPull.patch)
sha256sums=('cdc60df19ab08bfe55344395739bb08f50fc15c92da3962fac334d3bff116965'
            'a1904603c0292e76530f635dfc1828fb4e0d9d13555581cad33c0200640f7a27'
            'bcfc180708d089b5abe0ae1439809b5a4306a08917b0212c3d135e5ec56711f2'
            '540c517828d5573ba7bc3fd9b3811f39f4ea0132011d348d22bdfc545e865a8e'
            '1b55abeb867d66b7d3b7c34585e77e6d3656c6317b582c99f3280d37523c7718'
            '7a464eb7521ae8deb67516309bb396caa93135dc62fbad7351e67923b1766423'
            '2ed5cc3b57394ea33ad466ca9844b766e4cb91dd7b1e2b71deaf15cf881dbf51'
            '257f157cf2cc8947e0f5be4bff2c4afddbe73643e9e39a83171dbea02f5d52f4'
            '48deaaa07bfade35208edb9e22b4fe78f91470012414ddb26cd68f684c95e33d'
            'f31d51ebd8f8e0bd076cd1bce34b210c4dbbd959ca9b87693ad86a6399c492a3')

prepare() {
  cd $pkgname-$pkgver
  patch -Np1 -i ../01_gcc6.patch
  patch -Np1 -i ../03_CVE-2015-7747.patch
  patch -Np1 -i ../04_clamp-index-values-to-fix-index-overflow-in-IMA.cpp.patch
  patch -Np1 -i ../05_Always-check-the-number-of-coefficients.patch
  patch -Np1 -i ../06_Check-for-multiplication-overflow-in-MSADPCM-decodeSam.patch
  patch -Np1 -i ../07_Check-for-multiplication-overflow-in-sfconvert.patch
  patch -Np1 -i ../08_Fix-signature-of-multiplyCheckOverflow.-It-returns-a-b.patch
  patch -Np1 -i ../09_Actually-fail-when-error-occurs-in-parseFormat.patch
  patch -Np1 -i ../10_Check-for-division-by-zero-in-BlockCodec-runPull.patch
}

build() {
  cd "$srcdir/$pkgname-$pkgver"

  ./configure --prefix=/usr
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  make DESTDIR="$pkgdir" install
}

# vim:set ts=2 sw=2 et:
